package com.xingkeduo.pojo.enums;

import com.xingkeduo.util.pojo.base.BaseEnum;

/**
 * @author : gaozifeng
 * @return :  用户状态类
 * @date : 2019/5/30 16:09
 */
public enum ConsumerStatusEnums implements BaseEnum {
    MERGE(-1, "被合并"),
    BLACK_LIST(0, "黑名单"),
    NORMAL(1, "正常");

    private int value;
    private String desc;

    private ConsumerStatusEnums(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static boolean validValue(String value) {
        int value_int = Integer.parseInt(value);
        return validValue(value_int);
    }

    public static boolean validValue(int value) {
        ConsumerStatusEnums[] enums = values();

        for (int i = 0; i < enums.length; ++i) {
            if (enums[i].getValue() == value) {
                return true;
            }
        }

        return false;
    }

    public static ConsumerStatusEnums getBankValue(String value) {
        int value_int = Integer.parseInt(value);
        return getBankValue(value_int);
    }

    public static ConsumerStatusEnums getBankValue(int value) {
        ConsumerStatusEnums[] enums = values();

        for (int i = 0; i < enums.length; ++i) {
            if (enums[i].getValue() == value) {
                return enums[i];
            }
        }

        return null;
    }

    @Override
    public int getValue() {
        return this.value;
    }

    public String getDesc() {
        return this.desc;
    }
}
